Skip to content

Conversation

dido18
Copy link
Contributor

@dido18 dido18 commented May 15, 2025

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • Tests for the changes have been added (for bug fixes / features)

What kind of change does this PR introduce?
Feature for local testing of autoupdate.

What is the current behavior?

What is the new behavior?
Add an autoupdate:demo command to test the autoupdate of the agent on local machine.

  • By default, the new version is the current commit.
  • To provide a custom version, pass the VERSION=X.Y.Z to the task command.

Usage:

╰─$ task autoupdate:demo VERSION=3.0.3
Before continuing, please make sure you’ve opened the "Open Configuration" option from the Agent menu and set the updateUrl=http://127.0.0.1:3000/ [y/N]
y
task: [go:build] go build -v  -o arduino-cloud-agent -ldflags ' -X main.version=3.0.3 -X main.commit=b8c7f9e '
github.com/arduino/arduino-create-agent
task: [autoupdate:demo] go install github.com/sanbornm/go-selfupdate/...@latest
task: [autoupdate:demo] go-selfupdate -o public/CreateAgent/Stable ./arduino-cloud-agent 3.0.3
task: [autoupdate:demo] docker rm -f agent-static-server
agent-static-server
task: [autoupdate:demo] docker run --rm -d -v "$PWD/public:/usr/share/nginx/html:ro" -p 3000:80 --name agent-static-server nginx:alpine
ef6dfeaa9bd2b0b031c558c2f3cf4c214b9b77428bf74ad23371fb67ab92aedd
task: [autoupdate:demo] sleep 5
task: [autoupdate:demo] curl -X POST http://127.0.0.1:8991/update
{"success":"Please wait a moment while the agent reboots itself"}%   

To check that the update process was completed correctly, click on the tray icon of the agent and check the Agent Version X.X.X

  • Does this PR introduce a breaking change?
  • Other information:

@codecov-commenter
Copy link

codecov-commenter commented May 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 20.24%. Comparing base (e7ea376) to head (e2d2c38).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1033   +/-   ##
=======================================
  Coverage   20.24%   20.24%           
=======================================
  Files          42       42           
  Lines        3241     3241           
=======================================
  Hits          656      656           
  Misses       2498     2498           
  Partials       87       87           
Flag Coverage Δ
unit 20.24% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dido18 dido18 requested a review from a team May 15, 2025 10:26
Copy link
Contributor

@alessio-perugini alessio-perugini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just add a note that when chaning the config, we have to restart the agent otherwise the very firstrun of this task won't work, as the old agent picked up the default url

@per1234 per1234 added type: enhancement Proposed improvement topic: infrastructure Related to project infrastructure labels May 15, 2025
@dido18 dido18 merged commit b2b9887 into main May 15, 2025
49 checks passed
@dido18 dido18 deleted the taskfile-test-autorupdate branch May 15, 2025 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants